package com.binvshe.binvshe.activity;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * Created by Zoi.
 * E-mail：KyluZoi@gmail.com
 * 2016/9/24
 */

public class TicketSelectEntity implements Parcelable {

    /**
     * id : 49
     * name : 10月01日日场券
     * activity : {"id":4,"name":"名称","icon":"http://120.76.128.98/upload/14e25c8e-2fa2-4b97-adb4-6cdef61f0cb1.jpg","sponsor":"测试","introduction":"<p>123<\/p>","detail":"<p>12323232<\/p>","member_limit":"100","type":0,"club_id":0,"user_id":0,"begin_time":1473091200000,"end_time":1473955200000,"deadline":1474646400000,"province":"福建","city":"厦门","address":"福建省厦门市思明区莲前西路285号-之4","longitude":118.143504,"latitude":24.483033,"price":"￥100~123","member_count":1,"read_count":135,"share_count":0,"state":true,"del":false,"members":[],"banners":null}
     * combinations :
     * cycle : {"id":26,"activity_id":4,"through":false,"name":"10月01日 星期六","date":1475251200000}
     * times : {"id":6,"activity_id":4,"name":"日场","begin":"00:00","end":"12:00"}
     * original_price : 100
     * price : 0.01
     * remain : 1000
     * total : 1000
     * state : true
     * del : false
     * displayorder : 0
     * begin_time : 1475251200000
     * end_time : 1475294400000
     * create_time : 1474708988000
     * update_time : 1474708988000
     */

    private int id;
    private String name;

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    private boolean isSelected;
    /**
     * id : 4
     * name : 名称
     * icon : http://120.76.128.98/upload/14e25c8e-2fa2-4b97-adb4-6cdef61f0cb1.jpg
     * sponsor : 测试
     * introduction : <p>123</p>
     * detail : <p>12323232</p>
     * member_limit : 100
     * type : 0
     * club_id : 0
     * user_id : 0
     * begin_time : 1473091200000
     * end_time : 1473955200000
     * deadline : 1474646400000
     * province : 福建
     * city : 厦门
     * address : 福建省厦门市思明区莲前西路285号-之4
     * longitude : 118.143504
     * latitude : 24.483033
     * price : ￥100~123
     * member_count : 1
     * read_count : 135
     * share_count : 0
     * state : true
     * del : false
     * members : []
     * banners : null
     */

    private ActivityEntity activity;
    private String combinations;
    /**
     * id : 26
     * activity_id : 4
     * through : false
     * name : 10月01日 星期六
     * date : 1475251200000
     */

    private ActivityDateEntity cycle;
    /**
     * id : 6
     * activity_id : 4
     * name : 日场
     * begin : 00:00
     * end : 12:00
     */

    private ActivityTimeEntity times;
    private double original_price;
    private double price;
    private int remain;
    private int total;
    private boolean state;
    private boolean del;
    private int displayorder;
    private long begin_time;
    private long end_time;
    private long create_time;
    private long update_time;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ActivityEntity getActivity() {
        return activity;
    }

    public void setActivity(ActivityEntity activity) {
        this.activity = activity;
    }

    public String getCombinations() {
        return combinations;
    }

    public void setCombinations(String combinations) {
        this.combinations = combinations;
    }

    public ActivityDateEntity getCycle() {
        return cycle;
    }

    public void setCycle(ActivityDateEntity cycle) {
        this.cycle = cycle;
    }

    public ActivityTimeEntity getTimes() {
        return times;
    }

    public void setTimes(ActivityTimeEntity times) {
        this.times = times;
    }

    public double getOriginal_price() {
        return original_price;
    }

    public void setOriginal_price(int original_price) {
        this.original_price = original_price;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getRemain() {
        return remain;
    }

    public void setRemain(int remain) {
        this.remain = remain;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public boolean isState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    public boolean isDel() {
        return del;
    }

    public void setDel(boolean del) {
        this.del = del;
    }

    public int getDisplayorder() {
        return displayorder;
    }

    public void setDisplayorder(int displayorder) {
        this.displayorder = displayorder;
    }

    public long getBegin_time() {
        return begin_time;
    }

    public void setBegin_time(long begin_time) {
        this.begin_time = begin_time;
    }

    public long getEnd_time() {
        return end_time;
    }

    public void setEnd_time(long end_time) {
        this.end_time = end_time;
    }

    public long getCreate_time() {
        return create_time;
    }

    public void setCreate_time(long create_time) {
        this.create_time = create_time;
    }

    public long getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(long update_time) {
        this.update_time = update_time;
    }

    public static class ActivityEntity implements Parcelable {
        private int id;
        private String name;
        private String icon;
        private String sponsor;
        private String introduction;
        private String detail;
        private String member_limit;
        private int type;
        private int club_id;
        private int user_id;
        private long begin_time;
        private long end_time;
        private long deadline;
        private String province;
        private String city;
        private String address;
        private double longitude;
        private double latitude;
        private String price;
        private int member_count;
        private int read_count;
        private int share_count;
        private boolean state;
        private boolean del;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }

        public String getSponsor() {
            return sponsor;
        }

        public void setSponsor(String sponsor) {
            this.sponsor = sponsor;
        }

        public String getIntroduction() {
            return introduction;
        }

        public void setIntroduction(String introduction) {
            this.introduction = introduction;
        }

        public String getDetail() {
            return detail;
        }

        public void setDetail(String detail) {
            this.detail = detail;
        }

        public String getMember_limit() {
            return member_limit;
        }

        public void setMember_limit(String member_limit) {
            this.member_limit = member_limit;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public int getClub_id() {
            return club_id;
        }

        public void setClub_id(int club_id) {
            this.club_id = club_id;
        }

        public int getUser_id() {
            return user_id;
        }

        public void setUser_id(int user_id) {
            this.user_id = user_id;
        }

        public long getBegin_time() {
            return begin_time;
        }

        public void setBegin_time(long begin_time) {
            this.begin_time = begin_time;
        }

        public long getEnd_time() {
            return end_time;
        }

        public void setEnd_time(long end_time) {
            this.end_time = end_time;
        }

        public long getDeadline() {
            return deadline;
        }

        public void setDeadline(long deadline) {
            this.deadline = deadline;
        }

        public String getProvince() {
            return province;
        }

        public void setProvince(String province) {
            this.province = province;
        }

        public String getCity() {
            return city;
        }

        public void setCity(String city) {
            this.city = city;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public double getLongitude() {
            return longitude;
        }

        public void setLongitude(double longitude) {
            this.longitude = longitude;
        }

        public double getLatitude() {
            return latitude;
        }

        public void setLatitude(double latitude) {
            this.latitude = latitude;
        }

        public String getPrice() {
            return price;
        }

        public void setPrice(String price) {
            this.price = price;
        }

        public int getMember_count() {
            return member_count;
        }

        public void setMember_count(int member_count) {
            this.member_count = member_count;
        }

        public int getRead_count() {
            return read_count;
        }

        public void setRead_count(int read_count) {
            this.read_count = read_count;
        }

        public int getShare_count() {
            return share_count;
        }

        public void setShare_count(int share_count) {
            this.share_count = share_count;
        }

        public boolean isState() {
            return state;
        }

        public void setState(boolean state) {
            this.state = state;
        }

        public boolean isDel() {
            return del;
        }

        public void setDel(boolean del) {
            this.del = del;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.id);
            dest.writeString(this.name);
            dest.writeString(this.icon);
            dest.writeString(this.sponsor);
            dest.writeString(this.introduction);
            dest.writeString(this.detail);
            dest.writeString(this.member_limit);
            dest.writeInt(this.type);
            dest.writeInt(this.club_id);
            dest.writeInt(this.user_id);
            dest.writeLong(this.begin_time);
            dest.writeLong(this.end_time);
            dest.writeLong(this.deadline);
            dest.writeString(this.province);
            dest.writeString(this.city);
            dest.writeString(this.address);
            dest.writeDouble(this.longitude);
            dest.writeDouble(this.latitude);
            dest.writeString(this.price);
            dest.writeInt(this.member_count);
            dest.writeInt(this.read_count);
            dest.writeInt(this.share_count);
            dest.writeByte(state ? (byte) 1 : (byte) 0);
            dest.writeByte(del ? (byte) 1 : (byte) 0);
        }

        public ActivityEntity() {
        }

        protected ActivityEntity(Parcel in) {
            this.id = in.readInt();
            this.name = in.readString();
            this.icon = in.readString();
            this.sponsor = in.readString();
            this.introduction = in.readString();
            this.detail = in.readString();
            this.member_limit = in.readString();
            this.type = in.readInt();
            this.club_id = in.readInt();
            this.user_id = in.readInt();
            this.begin_time = in.readLong();
            this.end_time = in.readLong();
            this.deadline = in.readLong();
            this.province = in.readString();
            this.city = in.readString();
            this.address = in.readString();
            this.longitude = in.readDouble();
            this.latitude = in.readDouble();
            this.price = in.readString();
            this.member_count = in.readInt();
            this.read_count = in.readInt();
            this.share_count = in.readInt();
            this.state = in.readByte() != 0;
            this.del = in.readByte() != 0;
        }

        public static final Parcelable.Creator<ActivityEntity> CREATOR = new Parcelable.Creator<ActivityEntity>() {
            public ActivityEntity createFromParcel(Parcel source) {
                return new ActivityEntity(source);
            }

            public ActivityEntity[] newArray(int size) {
                return new ActivityEntity[size];
            }
        };
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.name);
        dest.writeByte(isSelected ? (byte) 1 : (byte) 0);
        dest.writeParcelable(this.activity, 0);
        dest.writeString(this.combinations);
        dest.writeParcelable(this.cycle, flags);
        dest.writeParcelable(this.times, flags);
        dest.writeDouble(this.original_price);
        dest.writeDouble(this.price);
        dest.writeInt(this.remain);
        dest.writeInt(this.total);
        dest.writeByte(state ? (byte) 1 : (byte) 0);
        dest.writeByte(del ? (byte) 1 : (byte) 0);
        dest.writeInt(this.displayorder);
        dest.writeLong(this.begin_time);
        dest.writeLong(this.end_time);
        dest.writeLong(this.create_time);
        dest.writeLong(this.update_time);
    }

    public TicketSelectEntity() {
    }

    protected TicketSelectEntity(Parcel in) {
        this.id = in.readInt();
        this.name = in.readString();
        this.isSelected = in.readByte() != 0;
        this.activity = in.readParcelable(ActivityEntity.class.getClassLoader());
        this.combinations = in.readString();
        this.cycle = in.readParcelable(ActivityDateEntity.class.getClassLoader());
        this.times = in.readParcelable(ActivityTimeEntity.class.getClassLoader());
        this.original_price = in.readInt();
        this.price = in.readDouble();
        this.remain = in.readInt();
        this.total = in.readInt();
        this.state = in.readByte() != 0;
        this.del = in.readByte() != 0;
        this.displayorder = in.readInt();
        this.begin_time = in.readLong();
        this.end_time = in.readLong();
        this.create_time = in.readLong();
        this.update_time = in.readLong();
    }

    public static final Parcelable.Creator<TicketSelectEntity> CREATOR = new Parcelable.Creator<TicketSelectEntity>() {
        public TicketSelectEntity createFromParcel(Parcel source) {
            return new TicketSelectEntity(source);
        }

        public TicketSelectEntity[] newArray(int size) {
            return new TicketSelectEntity[size];
        }
    };
}
